//
//  IdentityCardView.m
//  JinFuThree
//
//  Created by 毛韶谦 on 2018/9/6.
//  Copyright © 2018年 毛韶谦. All rights reserved.
//

#import "IdentityCardView.h"


@implementation IdentityCardView

- (instancetype)init {
    
    self = [super init];
    if (self) {
        self.backgroundColor = [UIColor whiteColor];
        
        UILabel *titleLabel = [[UILabel alloc] init];
        titleLabel.textColor = HexColor(0x999999);
        titleLabel.text = @"拍摄/上传身份证照片";
        titleLabel.font = [UIFont systemFontOfSize:12];
        [self addSubview:titleLabel];
        [titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.mas_equalTo(self.mas_left).offset(20);
            make.top.mas_equalTo(self.mas_top).offset(15);
        }];
        
        [self.leftIdentityView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.mas_equalTo(self.mas_left).offset(20);
            make.right.mas_equalTo(self.rightIdentityView.mas_left).offset(-8);
            make.top.mas_equalTo(self.mas_top).offset(36);
            make.bottom.mas_equalTo(self.mas_bottom).offset(-20);
        }];
        [self.rightIdentityView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.mas_equalTo(self.mas_top).offset(36);
            make.bottom.mas_equalTo(self.mas_bottom).offset(-20);
            make.width.mas_equalTo(self.leftIdentityView.mas_width);
            make.right.mas_equalTo(self.mas_right).offset(-8);
        }];
        
    }
    return self;
}


- (IdentityCardHasView *)leftIdentityView {
    
    if (!_leftIdentityView) {
        _leftIdentityView = [[IdentityCardHasView alloc] init];
        _leftIdentityView.hintLabel.text = @"拍摄人像面";
        _leftIdentityView.identityImageView.image = [UIImage imageNamed:@"ic_human face"];
        
        
        _leftIdentityView.suspensionImageView.hidden = YES;
        _leftIdentityView.removeBtn.hidden = YES;
        
        [self addSubview:_leftIdentityView];
    }
    return _leftIdentityView;
}
- (IdentityCardHasView *)rightIdentityView {
    
    if (!_rightIdentityView) {
        _rightIdentityView = [[IdentityCardHasView alloc] init];
        _rightIdentityView.hintLabel.text = @"拍摄国徽面";
        _rightIdentityView.identityImageView.image = [UIImage imageNamed:@"ic_national emblem"];
        _rightIdentityView.suspensionImageView.hidden = YES;
        _rightIdentityView.removeBtn.hidden = YES;
        
        [self addSubview:_rightIdentityView];
    }
    return _rightIdentityView;
}



/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
